import {defineConfig} from 'vite'
import vue from '@vitejs/plugin-vue'
import {ElementPlusResolver} from "vite-plugin-components";
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import styleImport from 'vite-plugin-style-import';
// @ts-ignore
import path from 'path'


// https://vitejs.dev/config/
export default defineConfig({
    plugins: [vue(),
        AutoImport({
            resolvers: [ElementPlusResolver()],
        }),
        Components({
            resolvers: [ElementPlusResolver()],
        }),
        styleImport({
            libs: [{
                libraryName: 'element-plus',
                esModule: true,
                resolveStyle: (name) => {
                    return `element-plus/theme-chalk/${name}.css`;
                },
                resolveComponent: (name) => {
                    return `element-plus/lib/${name}`;
                },
            }]
        })
    ], resolve: {
        alias: {
            '@': path.resolve(__dirname, 'src'), // src 路径
            'config': path.resolve(__dirname, 'src/config') // src 路径
        }
    },
})
